<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>充值记录管理</title>
	<meta name="decorator" content="default"/>
	 <link rel="stylesheet" href="${ctxStatic}/bootstrap/2.3.1/css_default/bootstrap.css" />
	<link href="${ctxStatic}/jquery-select2/3.4/select2.min.css" rel="stylesheet" />
	<script src="https://select2.github.io/vendor/js/jquery.min.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
	<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$(".js-example-basic-single").select2();
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		
		function excel(){
			$('#searchForm').attr('action',"${ctx}/jiujiu/jiuRechargeLog/excel");
			$('#searchForm').submit();
		}
		function search(){
			$('#searchForm').attr('action',"${ctx}/jiujiu/jiuRechargeLog");
			$('#searchForm').submit();
		}
	</script>
	<style type="text/css">
	
			.tan{
					background-color: #000;
					opacity:.5;
					position: fixed;
				    top: 0;
				    right: 0;
				    bottom: 0;
				    left: 0;
				    z-index: 22;
			    	display: none;
				}
				.liebiao{
					width: 600px;
					margin-left: -300px;
					height: 400px;
					margin-top: -200px; 
					display: none;
					position: fixed;
					top: 50%;
					z-index: 223;
					left: 50%;
				}
				
				.revoketan{
					background-color: #000;
					opacity:.5;
					position: fixed;
				    top: 0;
				    right: 0;
				    bottom: 0;
				    left: 0;
				    z-index: 22;
			    	display: none;
				}
				.revokeliebiao{
					width: 600px;
					margin-left: -300px;
					height: 400px;
					margin-top: -200px; 
					display: none;
					position: fixed;
					top: 50%;
					z-index: 223;
					left: 50%;
				}
	
	</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/jiujiu/jiuRechargeLog/">充值记录列表</a></li>
		<%-- <shiro:hasPermission name="jiujiu:jiuRechargeLog:edit"><li><a href="${ctx}/jiujiu/jiuRechargeLog/form">充值记录添加</a></li></shiro:hasPermission> --%>
	</ul>
	<form:form id="searchForm" modelAttribute="jiuRechargeLog" action="${ctx}/jiujiu/jiuRechargeLog/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>订单号：</label><form:input path="startOrderNo" htmlEscape="false" maxlength="50" class="input-medium"/>  -至-
		<form:input path="endOrderNo" htmlEscape="false" maxlength="50" class="input-medium"/>
		<br />
		<label>门店名称 ：</label>
		<form:select path="storeId" class="js-example-basic-single">
			<form:option value="">全部</form:option>
			<c:forEach items="${JiuStoreList}" var="jiuStore">
                   <form:option value="${jiuStore.id}">${jiuStore.name}</form:option>
			</c:forEach>
       	</form:select>
       	
		<label>充值渠道 ：</label>
		<form:select path="type">
			<form:option value="">全部</form:option>
            <form:option value="0">线下</form:option>
            <form:option value="1">微信</form:option>
       	</form:select>
       	
		<label>充值状态 ：</label>
		<form:select path="status">
			<form:option value="">全部</form:option>
            <form:option value="0">未充值</form:option>
            <form:option value="1">充值成功</form:option>
            <form:option value="2">已撤销</form:option>
            <form:option value="300">未完结</form:option>
            <form:option value="400">已完结</form:option>
       	</form:select>
       	
       	</br>
       	<label>充值时间 ：</label>
		
				<input id="startTime" name="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${jiuRechargeLog.startTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/> -至-
						
				<input id="endTime" name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${jiuRechargeLog.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/> 
		
		&nbsp;<input id="btnSubmit" class="btn btn-primary" type="button" value="查询" onclick="javascript:search()"/>
		&nbsp;<input class="btn btn-primary" type="button" value="导出" onclick="javascript:excel()"/>
	</form:form>
	<tags:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered ">
		<thead><tr>
		<th>订单号</th>
		<th>门店名称</th>
		<th>充值金额</th>
		<th>充值积分</th>
		<th>充值时间</th>
		<th>充值状态</th>
		<th>充值渠道</th>
		<th>确认人</th>
		<th>确认时间</th>
		<!-- <th>第几次充值</th> -->
		 <shiro:hasPermission name="jiujiu:jiuRechargeLog:edit"><th>操作</th></shiro:hasPermission></tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="jiuRechargeLog">
			<tr>
				<td>${jiuRechargeLog.orderNo}</td>
				<td>${jiuRechargeLog.storeName}</td>
				<td>${jiuRechargeLog.money}</td>
				<td>${jiuRechargeLog.point}</td>
				<td><fmt:formatDate value="${jiuRechargeLog.createTime}" type="both" pattern="yyyy-MM-dd HH:mm:ss" /> </td>
				<td>
					<c:choose>
					    <c:when test="${jiuRechargeLog.isRevoke eq '1'}">
					      	已撤销
					    </c:when>
					    <c:when test="${jiuRechargeLog.status eq '0'}">
					      	未充值
					    </c:when>
					    <c:when test="${jiuRechargeLog.status eq '1'}">
					      	充值成功 
					    </c:when>
					    <c:otherwise>
					    </c:otherwise>
					</c:choose>
				</td>
				<td>${jiuRechargeLog.type eq '0'?'线下':'微信 '}</td>
				<%-- <td>${jiuRechargeLog.rechargeSeveral}</td> --%>
				<td>${jiuRechargeLog.confirmPeople} </td>
				<td><fmt:formatDate value="${jiuRechargeLog.confirmTime}" type="both" pattern="yyyy-MM-dd HH:mm:ss" /> </td>
				 <shiro:hasPermission name="jiujiu:jiuRechargeLog:edit"><td>
				 <c:set var="isModifyChuNa" value="${fn:indexOf(fns:getUser().roleIdList, '12') == -1}" scope="page"/>
				 <c:set var="isModifyKuaiJi" value="${fn:indexOf(fns:getUser().roleIdList, '11') == -1}" scope="page"/>
				 <c:if test="${jiuRechargeLog.type eq '0' && jiuRechargeLog.status eq '0' && jiuRechargeLog.isRevoke ne '1'}">
				 	<c:if test="${isModifyKuaiJi }">	<!-- 平台会计  无权充值 -->
					 <a id="chong${jiuRechargeLog.id}" class="btn btn-success" href="javascript:chongzhi(${jiuRechargeLog.id})">充值</a>
					</c:if>
					 <%-- <a id="revoke${jiuRechargeLog.id}" class="btn btn-success editguanli" href="javascript:revoke(${jiuRechargeLog.id})">撤销</a> --%>
					<c:if test="${isModifyKuaiJi }">	<!-- 平台会计  无权撤销-->	
						<a id="revoke${jiuRechargeLog.id}" class="btn btn-success editrevoke" href="#" onclick="editdet(${jiuRechargeLog.id})">撤销</a>
                 	</c:if>
                 </c:if>
                 
                  <%--  <c:if test="${jiuRechargeLog.status ne '1'}">
                 	<a id="look${jiuRechargeLog.id}" class="btn btn-success" href="javascript:look(${jiuRechargeLog.id})">修改记录</a>
                 </c:if> --%>
                  
    				<%-- <a class="btn btn-success" href="${ctx}/jiujiu/jiuRechargeLog/form?id=${jiuRechargeLog.id}">修改</a>
					<a class="btn btn-danger" href="${ctx}/jiujiu/jiuRechargeLog/delete?id=${jiuRechargeLog.id}" onclick="return confirmx('确认要删除该充值记录吗？', this.href)">删除</a> --%>
				
			
                 
               <%--   <a class="btn btn-success" href="${ctx}/jiujiu/jiuRechargeLog/form?id=${jiuRechargeLog.id}">修改</a> --%>
				 <c:if test="${not empty jiuRechargeLog.voucher }">
                    <a class="btn btn-success" href="${ctx}/jiujiu/jiuRechargeLog/viewVoucher?id=${jiuRechargeLog.id}">查看凭证</a>
                 </c:if>
                 <c:if test="${isModifyKuaiJi }">	<!-- 平台会计  无权上传凭证，修改凭证，申请修改订单 -->
                    <c:if test="${jiuRechargeLog.status == 1}">
                    	<c:if test="${empty jiuRechargeLog.voucher }">
                    	<a class="btn btn-success" href="${ctx}/jiujiu/jiuRechargeLog/formVoucher?id=${jiuRechargeLog.id}">上传凭证</a>
	                  	</c:if>
	                  	
						<c:if test="${isModifyChuNa }">	<!-- 平台出纳  无权修改凭证 -->
		                  	<c:if test="${not empty jiuRechargeLog.voucher }">
	                    		<a class="btn btn-danger" href="${ctx}/jiujiu/jiuRechargeLog/formVoucher?id=${jiuRechargeLog.id}">修改凭证</a>
		                  	</c:if>	
		                </c:if>
                  	 	<c:if test="${empty jiuRechargeLog.voucher  && jiuRechargeLog.status eq '1'}">
		                 	<a id="apply${jiuRechargeLog.id}" class="btn btn-success" href="javascript:apply(${jiuRechargeLog.id})">申请修改订单</a>
		                 </c:if>
                  	 </c:if>
                  </c:if> 
                  	 <c:if test="${jiuRechargeLog.isRevoke eq '1'}">
                  		 <button  type="button" class="btn btn-success"  onclick="showdet(${jiuRechargeLog.id})" style="border-radius: 5px;" >查看撤销</button>  
					</c:if>
                  	<%--  <c:if test="${jiuRechargeLog.status eq '1'}">
                  		 <a class="btn btn-success" href="http://jieli.hbweiyinqing.cn/jiujiu/a/jiujiu/jiuRechargeLogAudit?orderNo=${jiuRechargeLog.orderNo }">修改订单记录</a>
					</c:if> --%>
				</td></shiro:hasPermission>
				
				
			</tr>
			
	<!--弹幕-->
	<div   id="tan_${jiuRechargeLog.id }" class="tan"></div>
	<div class="row-fluid liebiao" id="liebiao_${jiuRechargeLog.id }"  style="background:#fff;height: 280px;
    margin-top: -240px;">
    
		     <div class="widget-box"  >
		        <div class="widget-title"> 
		          <h5 style="margin-left: 20px">撤销详情</h5>
		         <span style="position: absolute;right: 8px; font-size: 24px;top: 5px; cursor:pointer" onclick="guanbidet(${jiuRechargeLog.id })" >&times;</span> 
		        </div>
		        <div class="widget-content nopadding" style="padding-left: 80px;">		        	
			      
		  <%--    <div class="control-group" style="display: -webkit-box;">
			            <label class="control-label">修改凭证1</label>
			              <div class="controls" style="width: 60px;height: 60px;">
			               <img  id="detcertificatepic" style="margin-left:20px"   src="${ctxUser }/score/${jiuRechargeLog.certificatepic}" alt="" />
			                
			              </div>
			            </div>
			            
			            <div class="control-group" style="display: -webkit-box;">
			              <label class="control-label">修改凭证2</label>
			              <div class="controls" style="width: 60px;height: 60px;">
			               <img  id="detcertificatepic" style="margin-left:20px"   src="${ctxUser }/score/${jiuRechargeLog.certificatepictwo}" alt="" />
			                
			              </div>
			            </div>  --%>
			            <div class="control-group" style="display: -webkit-box;">
			              <label class="control-label" style="margin-left:20px">撤销人</label>
			              <div class="controls" style="width:300px;">
			               <span  id="detrevokePeoplename" style="margin-left:20px" >${jiuRechargeLog.revokePeople } </span>
			              </div>
			            </div>
			             <div class="control-group" style="display: -webkit-box;">
			              <label class="control-label">撤销时间</label>
			              <div class="controls" style="width:300px;">
			               <span  id="detrevokeTime" style="margin-left:20px" ><fmt:formatDate value="${jiuRechargeLog.revokeTime }" pattern="yyyy-MM-dd HH:mm:ss"/> </span>
			              </div>
			            </div>
			                <div class="control-group" style="display: -webkit-box;">
			              <label class="control-label">撤销原因</label>
			              <div id="detrevokeTime"  class="controls"  style="width:300px;">
			               <!-- <span  id="detrevokeTime" style="margin-left:20px" ></span> -->
			               
			               <div style="height: 90px; width: 420px; margin-left: 20px; border: 1px solid #dfdfdd;">
			               
			               <span>${jiuRechargeLog.revokeReason }</span></div>
			              </div>
			            </div>
			            <div class="form-actions" style="text-align: center;">
			            <button type="button" class="btn btn-info "   onclick="guanbidet(${jiuRechargeLog.id })"  style="width: 90px;border-radius: 15px;font-size: 16px;margin-left:-100px">关闭</button>
			            </div>
			         
			        </div>
      			</div>			          
	</div> 
	<!--end  -->
	
	
		</c:forEach>
		<tr>
			<td>-</td>
			<td>-</td>
			<td>${map.moneySum}</td>
			<td>${map.pointSum}</td>
			<td>-</td>
			<td>-</td>
			<td>-</td>
			<td>-</td>
			<td>-</td>
			<td>-</td>
		</tr>
		</tbody>
	</table>
	
	<div class="pagination">${page}</div>
	
	
	
	
	<!--弹幕-->
	<div class="revoketan"></div>
	<div class="row-fluid revokeliebiao" style="background:#fff  ;height: 280px;">
    
		     <div class="widget-box"  >
		        <div class="widget-title"> 
		          <h5 style="margin-left: 20px">撤销申请</h5>
		         <span style="position: absolute;right: 8px; font-size: 24px;top: 5px; cursor:pointer" class="guanbirevoke">&times;</span> 
		        </div>
		        <div class="widget-content nopadding">		        	
			  <form:form id="inputForm" action="${ctx}/jiujiu/jiuRechargeLog/modifyCheXiaoRen" method="post" class="form-horizontal" enctype="multipart/form-data" style="margin-top:80px" >    
		    		<!-- <div class="control-group">
		    		
		    		
			              <label class="control-label">修改凭证1</label>
			              
			              <div class="control">
									<input type="file" name="detcertificatepic" htmlEscape="false"   style="padding-left:40px"/>   
									<input type="hidden"  id="detid" name="id">  
						 </div>
			            </div>
			            
			            <div class="control-group">
			              <label class="control-label">修改凭证2</label>
			                 <div class="control">
									<input type="file" name="detcertificatepictwo" htmlEscape="false"   style="padding-left:40px"/>     
						</div>
			            </div>  -->
			            <div class="control-group">
			              <label class="control-label">撤销原因</label>
			              <div class="controls" style="width:300px;">
			            
			               <input  name="revokeReason"  value="">
			               	<input type="hidden"  id="detid"   name="id">  
			              </div>
			            </div>
			           
			            <div class="form-actions" style="text-align: center;padding-left: 0px;">
			          
			            <button type="submit" class="btn btn-info guanbirevoke" style="width: 90px;border-radius: 15px;font-size: 16px;">提交</button>
			            </div>
			         </form:form>
			        </div>
      			</div>			          
	</div> 
	<!--end  --> 
	<script type="text/javascript">
	 //显示
	
		function showdet(id){
		
			 		var item =""+id;
					$("#tan_"+item+"").fadeIn().show();
					$("#liebiao_"+item+"").fadeIn().show();
				
		}
	 function guanbidet(id){
		 
			var item =""+id;
			$("#tan_"+item+"").hide();
			$("#liebiao_"+item+"").hide(); 
		 
	 }
	</script>
	<script type="text/javascript">
		
	//修改
			function editdet(id){
				 document.getElementById("detid").value = id;
				 
			}
	
	</script>
	<script>
			$(document).ready(function(){
				
				$('.editrevoke').click(function(){
					$('.revoketan').fadeIn().show();
					$('.revokeliebiao').fadeIn().show();
				})
				$('.guanbirevoke').click(function(){					
					$('.revokeliebiao').hide();
					$('.revoketan').hide();
				})
			})
		</script>
	
	
	<script>
		var tag=0;
		function chongzhi(id){
			if(tag==1){
				return false;
			}
			tag=1;
			$.getJSON("${ctx}/jiujiu/jiuRechargeLog/chongzhi",{id:id}, function(data){
                 alert(data.message);
                 $('#revoke'+id).hide();
                 $('#chong'+id).hide();
            });
		}
		
		function revoke(id){
			$.getJSON("${ctx}/jiujiu/jiuRechargeLog/revoke",{id:id}, function(data){
                 alert(data.message);
                 $('#chong'+id).hide();
                 $('#revoke'+id).hide();
            });
		}
		
		function apply(id){
			$.getJSON("${ctx}/jiujiu/jiuRechargeLogAudit/applyChongZhi",{id:id}, function(data){
                 alert(data.message);
                 $('#chong'+id).hide();
                 $('#revoke'+id).hide();
            });
		}
		
	</script>
</body>
</html>
